<?php
include_once 'src/config/cfPetshop.php';
$cf = new cfPetshop();
?>

<h1 class='text-info'>Venda</h1>
<h3 class='text-success'>Venda não finalizada</h3>
<a href="?s=cvenda&adicionar" class="btn btn-sm btn-primary" title="Adicionar venda"><i class="glyphicon glyphicon-plus"></i> Adicionar nova venda</a><br/><br/>
<table class="table table-striped table-hover">
    <tr>
        <th>Data</th>
        <th>Hora</th>
        <th>Total</th>
        <th>Funcionario</th>
        <th>PET</th>
        <th>Cliente</th>
        <th>Opções</th>
    </tr>
    <?php foreach ($lista as $ele) { ?>
        <tr>
            <td><?= $cf->dateTimeToBR($ele['data']) ?></td>
            <td><?= $ele['hora'] ?></td>
            <td><?= $ele['total'] ?></td>
            <td><?= $ele['funcionario'] ?></td>
            <td><?= $ele['pet'] ?></td>
            <td><?= $ele['cliente'] ?></td>
            <td>
                <a href="?s=cvenda&del=<?= $ele['idvenda'] ?>" class="btn btn-xs btn-danger" title="excluir venda"><i class="glyphicon glyphicon-trash"></i></a>
                <a href="?s=cServicosComprados&idvenda=<?= $ele['idvenda'] ?>" class="btn btn-xs btn-success" title="Add itens venda"><i class="glyphicon glyphicon-plus"></i></a>
            </td>
        </tr>
    <?php } ?>
</table>   


<h3 class='text-danger'>Venda Finalizadas</h3>
<table class="table table-striped table-hover">
    <tr>
        <th>Data</th>
        <th>Hora</th>
        <th>Total</th>
        <th>Funcionario</th>
        <th>PET</th>
        <th>Cliente</th>
    </tr>
    <?php foreach ($listaFechadas as $ele) { ?>
        <tr>
            <td><?= $cf->dateTimeToBR($ele['data']) ?></td>
            <td><?= $ele['hora'] ?></td>
            <td><?= $ele['total'] ?></td>
            <td><?= $ele['funcionario'] ?></td>
            <td><?= $ele['pet'] ?></td>
            <td><?= $ele['cliente'] ?></td>
        </tr>
    <?php } ?>
</table>   